package com.youhome.service.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.youhome.service.mapper.BSendRecordSMSMapper;
import com.youhome.service.model.BSendRecordSMS;
import com.youhome.service.service.BSendRecordSMSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.util.List;

/**
 * Created by chen365 on 2017/12/15.
 */
@Service
public class BSendRecordSMSServiceImpl implements BSendRecordSMSService {
    @Autowired
    private BSendRecordSMSMapper bSendRecordSMSMapper;

    @Override
    public PageInfo<BSendRecordSMS> selectByBean(Integer pageIndex, Integer pageSize, BSendRecordSMS record) {
        if (StringUtils.isEmpty(pageIndex) || pageIndex < 1) {
            pageIndex = 1;
        }
        if (StringUtils.isEmpty(pageSize) || pageSize < 1) {
            pageSize = 10;
        }
        PageHelper.startPage(pageIndex, pageSize);
        List<BSendRecordSMS> list = bSendRecordSMSMapper.selectByBean(record);
        return new PageInfo<>(list);
    }
}
